package com.winspread.app.AutoCompleteTextVeiw

import android.widget.ArrayAdapter
import com.winspread.active.extension.toast
import com.winspread.app.R
import com.winspread.app.databinding.ActivityAutoEdittextBinding
import com.winspread.mvvm.base.vm.BaseNotVmActivity

class AutoEdittextActivity : BaseNotVmActivity<ActivityAutoEdittextBinding>(R.layout.activity_auto_edittext) {

    var res = mutableListOf("beiji1", "beiji12", "beiji123", "beiji1234")

    var arrayAdapter: ArrayAdapter<String>? = null

//    override fun initView() {
//        binding.autoEt.setDropDownBackgroundResource(R.drawable.toast_success_bg)
//        arrayAdapter = ArrayAdapter(this, android.R.layout.simple_list_item_1, res)
//        binding.autoEt.setAdapter(arrayAdapter)
//    }


    override fun initView() {
        binding.autoEt.setDropDownBackgroundResource(R.drawable.toast_success_bg)
        val myAdapter = AutoEdAdapter(this) {
            "${it}".toast()
            binding.autoEt.dismissDropDown()
        }
        binding.autoEt.isFocusable = true
        binding.autoEt.setAdapter(myAdapter)
        myAdapter.setDataList(res)


    }

}